home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue66 / SQLComp / DMSQLBDE.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2000-09-20  |  1.1 KB  |  59 lines

  1. unit DMSQLBDE;
  2.  
  3. interface
  4.  
  5. uses
  6.   Classes, DMSQLBase, DBTables;
  7.  
  8. type
  9.   // A TQuery that can change its where clause.
  10.   TDMSQLQuery = class(TQuery, IDMSQLQuery)
  11.   private
  12.     FImplementor: TDMSQLQueryImpl;
  13.     procedure AfterBuild(Sender: TDMSQLQueryImpl);
  14.     procedure BeforeBuild(Sender: TDMSQLQueryImpl);
  15.     procedure SetSQLText(Value: string);
  16.   protected
  17.     procedure Loaded; override;
  18.   public
  19.     constructor Create(AOwner: TComponent); override;
  20.   published
  21.     property Implementor: TDMSQLQueryImpl read FImplementor write FImplementor;
  22.   end;
  23.  
  24. implementation
  25.  
  26. uses
  27.   DMSQLUtils;
  28.  
  29. { TDMSQLQuery }
  30.  
  31. constructor TDMSQLQuery.Create(AOwner: TComponent);
  32. begin
  33.   inherited;
  34.   FImplementor := TDMSQLQueryImpl.Create(Self);
  35. end;
  36.  
  37. procedure TDMSQLQuery.BeforeBuild(Sender: TDMSQLQueryImpl);
  38. begin
  39. end;
  40.  
  41. procedure TDMSQLQuery.AfterBuild(Sender: TDMSQLQueryImpl);
  42. begin
  43.   if sqlOpenAfterBuild in Sender.SQLOptions then
  44.     Open;
  45. end;
  46.  
  47. procedure TDMSQLQuery.Loaded;
  48. begin
  49.   inherited;
  50.   FImplementor.BaseSQL := SQL;
  51. end;
  52.  
  53. procedure TDMSQLQuery.SetSQLText(Value: string);
  54. begin
  55.   SQL.Text := Value;
  56. end;
  57.  
  58. end.
  59.